
package com.task.base;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class CustomTitle extends View {

    private String name;

    private int iconId;
    
    private Resources res;
    
    private Paint paint =new Paint();

    public CustomTitle(Context context, String name, int iconId) {
        super(context);
        res=context.getResources();
        this.name = name;
        this.iconId = iconId;
    }
    
    public CustomTitle(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        
        canvas.drawBitmap(BitmapFactory.decodeResource(res, iconId), 0, 10, paint);
        
        canvas.drawText(name, 30, 10, paint);
    }
}
